package com.kgo.eidtor.controller;

import com.google.gson.Gson;
import com.kgo.eidtor.entity.ModuleBean;
import com.kgo.eidtor.entity.ProjectBean;
import com.kgo.eidtor.service.ProjectService;
import com.kgo.eidtor.util.ResultUtil;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@CrossOrigin
public class ProjectController {
    @Resource
    private ProjectService projectService;
    private Gson _gs = new Gson();
    @RequestMapping(value = "/project" ,method = RequestMethod.POST,produces="text/plain;charset=UTF-8")
    public String addProject(ProjectBean project){
        int rowCount = projectService.addProject(project);
        return ResultUtil.add(rowCount);
    }

    /**
     * 获取系统code
     * @param
     * @return
     */
    @RequestMapping(value = "/project/code" ,method = RequestMethod.GET,produces="text/plain;charset=UTF-8")
    public String getProjectCode(){
        return projectService.getProjectCodes();
    }

    @RequestMapping(value = "/project/item/count" ,method = RequestMethod.GET,produces="text/plain;charset=UTF-8")
    public String getProjectItemCount(String id) {
        return projectService.getProjectItemCount(id);
    }
}
